<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
</head>
    <link rel="stylesheet" href="${path}/layui/css/layui.css" media="all">
    <script src="${path}/js/jquery.min.js"></script>
    <script src="${path}/layui/layui.js"></script>
<body>
<style>
    #chatEdit input{
        border: none;
    }
</style>
<script>
    //  获取时间
    function getNow(s) {
        return s < 10 ? '0' + s : s;
    }
    function dates() {
        var now = new Date();
        //格式化日，如果小于9，前面补0
        var day = ("0" + now.getDate()).slice(-2);
        //格式化月，如果小于9，前面补0
        var month = ("0" + (now.getMonth() + 1)).slice(-2);
        // var h = now.getHours();
        // var minute = now.getMinutes();
        // var s = now.getSeconds();
        //拼装完整日期格式
        var today = now.getFullYear() + "-" + (month) + "-" + (day);
        // var today = now.getFullYear() + "-" + (month) + "-" + (day) + " " + getNow(h) + ":" + getNow(minute) + ":" + getNow(s);
        return today;
    }
    $("#begin").val(dates());
    $("#shijian").val(dates());
</script>
<br>
<h1 style="text-align: center">会员管理</h1>
<hr>
<%--显示详细信息--%>
<div id="chatEdit" style="margin-top: 20px;display: none;">
    <form class="layui-form" id="chatEditForm" lay-filter="chatEditForm" name="chatEditForm">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">会员名称：</label>
                <div class="layui-input-inline">
                    <input type="text" name="name"  value="" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">会员卡名：</label>
                <div class="layui-input-inline">
                    <input type="text" id="kaming" value=""  class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">金额：</label>
                <div class="layui-input-inline">
                    <input type="text" name="money" value="" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">积分：</label>
                <div class="layui-input-inline">
                    <input type="text" name="integral" value=""  class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">开始时间：</label>
                <div class="layui-input-inline">
                    <input type="text" name="begintime"  value="" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">结束时间：</label>
                <div class="layui-input-inline">
                    <input type="text" name="endtime" value=""  class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">消费积分：</label>
                <div class="layui-input-inline">
                    <input type="text" name="xFintegral"  value="" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">会员卡号：</label>
                <div class="layui-input-inline">
                    <input type="text" name="iDKaHao" value="" class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">操作员：</label>
                <div class="layui-input-inline">
                    <input type="text" id="czy" value="" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">性别：</label>
                <div class="layui-input-inline">
                    <input type="radio" name="sex1" id="nan" value="0" title="男" >
                    <input type="radio" name="sex1" id="nv" value="1" title="女" >
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">手机号：</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone"  value="" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">地址：</label>
                <div class="layui-input-inline">
                    <input type="text"name="address" value=""  class="layui-input" readonly>
                </div>
            </div>
        </div>
    </form>
</div>

<%--修改信息--%>

<div id="update" style="margin-top: 20px;display:none;">
    <form class="layui-form" id="updatefrom" lay-filter="updatefrom" name="updatefrom">
        <input type="hidden" name="id">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">会员名称：</label>
                <div class="layui-input-inline">
                    <input type="text" name="name"  value="" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">手机号：</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone"  value=""  class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">地址：</label>
                <div class="layui-input-inline">
                    <input type="text" name="address"  value="" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">性别：</label>
                <div class="layui-input-inline">
                    <input type="radio" name="sex" id="nan1" value="0" title="男">
                    <input type="radio" name="sex" id="nv1" value="1" title="女" >
                </div>
            </div>
        </div>
    </form>
</div>
<%--增加会员--%>
<div id="add" style="margin-top: 20px;display: none;">
    <form class="layui-form" id="addform" lay-filter="addform" name="addform">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">会员名称：</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" id="name" autocomplete="off"  value="" class="layui-input" >
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">会员卡名：</label>
                <div class="layui-input-inline" style="width: 190px;">
                        <select name="viptypeid" id="rolesss">
                        <option value="-1">全部</option>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">开始时间：</label>
                <div class="layui-input-inline">
                    <input type="date" name="begintime" id="begin"  value="" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">结束时间：</label>
                <div class="layui-input-inline">
                    <input type="date" name="endtime" id="end" value=""  class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">会员卡号：</label>
                <div class="layui-input-inline">
                    <input type="text" name="iDKaHao" id="huiyuanid" value="" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">性别：</label>
                <div class="layui-input-inline">
                    <input type="radio" name="sex" value="0" title="男" checked>
                    <input type="radio" name="sex"  value="1" title="女" >
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">操作员：</label>
                <div class="layui-input-inline">
                    <input type="text"  value="${loginout}" id="people" class="layui-input" readonly>
                    <input type="hidden" value="${admin.id}" name="operator">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">手机号：</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone"  autocomplete="off" id="phone" value="" class="layui-input" >
                </div>
            </div>
        </div>
        <div class="layui-form-item">

            <div class="layui-inline">
                <label class="layui-form-label">地址：</label>
                <div class="layui-input-inline">
                    <input type="text"name="address" autocomplete="off" id="address" value=""  class="layui-input">
                </div>
            </div>
            <input type="hidden" name="money" id="moneyss">
        </div>
    </form>
</div>

<%--充值金额--%>
<div id="money" style="margin-top: 20px;display:none;">
    <form class="layui-form" id="moneyform" lay-filter="moneyform" name="moneyform">
        <input type="hidden" name="id" id="iddd">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">金额：</label>
                <div class="layui-input-inline">
                    <input type="text" name="money" id="jine" autocomplete="off"  class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">积分：</label>
                <div class="layui-input-inline">
                    <input type="text" name="integral" id="jifen" autocomplete="off"  class="layui-input">
                </div>
            </div>
        </div>
    </form>
</div>
<%--状态--%>
<div id="stat" style="margin-top: 20px;display:none;margin-left: 50px;padding-top: 30px;">
    <form class="layui-form" id="statform" lay-filter="statform" name="statform">
        <div class="layui-form-item">
            <div class="layui-inline ">
                    <input type="radio" name="a" value="2" title="挂失" checked>
                    <input type="radio" name="a"  value="3" title="补卡" >
                    <input type="radio" name="a"  value="4" title="换卡" >
                    <input type="radio" name="a"  value="5" title="退卡" >
            </div>
        </div>
    </form>
</div>
<div style="display: none">
    <form class="layui-form" id="typeform" lay-filter="typeform" name="typeform">
        <input type="text"id="mingchen" name="name">
        <input type="text" id="shijian" name="time">
        <input type="text" id="zhuangtai" name="type">
        <input type="text" id="card"  name="viptypeid">
        <input type="text" id="peoples" name="people">
    </form>
</div>
<div id="phonesss" style="display:none;">
    <form class="layui-form" id="phoneform" lay-filter="phoneform" name="phoneform">
        <div class="layui-form-item" style="padding-top: 30px;">
            <div class="layui-inline">
                <label class="layui-form-label">预留手机号:</label>
                <div class="layui-input-inline">
                    <input type="text" autocomplete="off" name="yuliuphone" id="yuliuaaa"  class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">会员卡：</label>
                <div class="layui-input-inline">
                    <input type="text" autocomplete="off" id="idcardaaa"  class="layui-input" readonly>
                </div>
            </div>
        </div>
    </form>
</div>
<%--换卡--%>
<div id="huanka" style="display:none;">
    <form class="layui-form" id="huankaform" lay-filter="huankaform" name="huankaform">
        <div class="layui-form-item" style="padding-top: 30px;">
            <div class="layui-inline">
                <label class="layui-form-label">当前会员卡:</label>
                <div class="layui-input-inline">
                    <input type="text" autocomplete="off" name="yuliuphone" id="danqianhuiuan"   class="layui-input" readonly>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">会员卡：</label>
                <div class="layui-input-inline">
                    <div class="layui-input-inline" style="width: 190px;">
                        <select name="viptypeid" id="huiyuankaid">
                            <option value="-1">全部</option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item" >
            <div class="layui-inline">
                <label class="layui-form-label">所需金额:</label>
                <div class="layui-input-inline">
                    <input type="text" autocomplete="off" id="jinejine"  name="money"  class="layui-input" readonly>
                </div>
            </div>
            <input type="hidden" id="jifenaa" name="integral">
            <input type="hidden" id="idddddd" name="id">
        </div>
    </form>
</div>
    <form class="layui-form" action="" style="margin-top: 30px;">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">会员名</label>
                <div class="layui-input-inline" style="width: 200px;">
                    <input id="username" type="text"  name="name" autocomplete="off" class="layui-input">
                </div>
                <label class="layui-form-label">会员卡</label>
                <div class="layui-input-inline" style="width: 300px;">
                    <select name="" id="roles">
                        <option value="-1">全部</option>
                    </select>
                </div>
                <div class="layui-input-inline" style="width: 100px;">
                    <button type="button" class="layui-btn layui-btn-normal" onclick="SearchData();"><i class="layui-icon layui-icon-search"></i> 查询</button>
                </div>
            </div>

        </div>
    </form>
    <table class="layui-table" lay-data="{id:'vipTable',url:'${path}/Vip/list', page:true,toolbar:'#toolbarDemo',defaultToolbar: ['filter', 'print', 'exports'],even: true}"
           lay-filter="vipTable">
        <thead>
        <tr>
            <th lay-data="{type:'checkbox'}">hello</th>
            <th lay-data="{field:'iDKaHao'}">会员卡号</th>
            <th lay-data="{field:'name'}">会员名称</th>
            <th lay-data="{templet:'#idcard'}">会员卡</th>
            <th lay-data="{field:'money'}">金额</th>
            <th lay-data="{field:'integral'}">积分</th>
            <th lay-data="{field:'phone'}">手机号</th>
            <%--<th lay-data="{field:'xFintegral}">消费积分</th>--%>
            <th lay-data="{templet:'#Integer'}">状态</th>
            <th lay-data="{toolbar:'#barDemo'}">操作</th>
        </tr>
        </thead>
    </table>
</body>
<script>
    layui.use(['form'],function () {
        var form = layui.form
        layui.form.render();
        form.render('select');
        form.on("select", function(data){
            $.post("${path}/Vip/getmoney",{id:data.value},function (str) {
                console.log(str);
                $("#moneyss").val(str.money);
                $("#jinejine").val(str.money);
                form.render('select');
            })
        });
    })

    document.getElementById("jine").oninput = function() {myFunction()};
    function myFunction() {
        
        var a=$("#jine").val();
        $("#jifen").val(a);
    }
    $.get("${path}/Vip/viptypesearch",function (data) {
        $.each(data,function () {
            var opt=$("<option></option>").appendTo("#roles");
            opt.text(this.name).val(this.id);
        })
    })
    $.get("${path}/Vip/viptypesearch",function (data) {
        $.each(data,function () {
            var opt=$("<option></option>").appendTo("#rolesss");
            opt.text(this.name).val(this.id);

        })
    })

    layui.use(["table","form"],function() {
        layui.form.val('chatEditForm',${sessionScope.vip});
        var table = layui.table;
        table.on('toolbar(vipTable)',function (obj) {
            switch (obj.event) {
                case "add":
                    layer.open({
                    type: 1,
                    title: "增加会员",
                    skin: "layui-layer-molv",
                    anim: 0,
                    offset:"120px",
                    area: "800px",
                    content: $("#add"),
                    btn: ['确定','返回'],
                    success: function () {
                        fomrReset();
                        $("#begin").val(dates());
                        random();
                    },
                    yes:function (index) {
                        var name=$("#name").val();
                        var rolesss=$("#rolesss").val();
                        var phone=$("#phone").val();
                        var address=$("#address").val();
                        var end=$("#end").val();
                        var begin= $("#begin").val();
                        if(name==null || name=="" ){
                            layer.msg("请填写会员名称...",function () {});
                            return false;
                        }
                        if(rolesss==-1){
                            layer.msg("请选择会员卡...",function () {});
                            return false
                        }
                        if(phone==null || phone=="" ){
                            layer.msg("请填写手机号...",function () {});
                            return false;
                        }
                        if(address==null || address=="" ){
                            layer.msg("请填写地址...",function () {});
                            return false;
                        }
                        if(end==""||end==null){
                            layer.msg("请选择结束时间...",function () {});
                            return false;
                        }
                        var startNum = parseInt(begin.replace(/-/g,''),10);
                        var endNum = parseInt(end.replace(/-/g,''),10);
                        if(startNum>endNum){
                            layer.msg("结束时间不能在开始时间之前...",function () {});
                            return false;
                        }
                        var  str=$("#addform").serialize();
                        console.log(str);
                        $.post("/Vip/addvip",str,function () {
                            layer.close(index);
                            table.reload('vipTable');
                        })
                    }
                });
                    break;
                case "batchDelete":
                    var rows = table.checkStatus('vipTable');
                    var data = rows.data;
                    if(data.length == 0){
                        layer.msg("请选择要删除的数据",function(){});
                        return;
                    }
                    layer.confirm('确定要删除这么多数据吗？',{icon:5,title:'友情提示'},function (index) {
                        var params = "";
                        for(let vipTable of data){
                            params += "ids="+vipTable.id+"&";
                        }
                        $.post('${path}/Vip/batchDelete',params,function () {
                            layer.close(index);
                            table.reload('vipTable');
                        });
                    });
                    break;
            }
        })
        table.on('tool(vipTable)',function (obj) {
            var e=obj.event;
            var data =obj.data;
            var dataid=obj.data;
            switch (e) {
                case "select":
                layer.open({
                    type: 1,
                    title: "详细信息",
                    skin: "layui-layer-molv",
                    anim: 0,
                    offset:"120px",
                    area: "800px",
                    content: $("#chatEdit"),
                    btn: ['返回'],
                    success: function () {
                        $("#czy").val(data.admin.name);
                        $("#kaming").val(data.vipType.name)
                         layui.form.val("chatEditForm",data);
                        if(data.sex == 0){
                            $("input:radio[name='sex1']")[0].checked = true;
                            layui.form.render('radio');
                        }else if (data.sex ==1) {
                            $("input:radio[name='sex1']")[1].checked = true;
                            layui.form.render('radio');
                        }
                    }
                });
                break;
                case "update":
                    layer.open({
                        type: 1,
                        title: "修改信息",
                        skin: "layui-layer-molv",
                        anim: 0,
                        offset:"120px",
                        area: "800px",
                        content: $("#update"),
                        btn: ['确定','返回'],
                        success: function () {
                            layui.form.val("updatefrom",data);
                            if(data.sex == 0){
                                $("input:radio[name='sex']")[0].checked = true;
                                layui.form.render('radio');
                            }else if (data.sex ==1) {
                                $("input:radio[name='sex']")[1].checked = true;
                                layui.form.render('radio');
                            }
                        },
                        yes:function (index) {
                            var str=$("#updatefrom").serialize();
                            $.post("/Vip/updatevip",str,function () {
                                layer.msg("修改成功...");
                                layer.close(index);
                                table.reload("vipTable");
                            })
                        }
                    });
                    break;
                case "money":
                    layer.open({
                        type: 1,
                        title: "充值金额",
                        skin: "layui-layer-molv",
                        anim: 0,
                        offset:"120px",
                        area: "450px",
                        content: $("#money"),
                        btn: ['确定','返回'],
                        success: function () {
                            console.log(data)
                            $("#iddd").val(data.id);
                            $("#jine").val('');
                            $("#jifen").val('');

                        },
                        yes:function (index) {
                            var a=$("#jine").val();
                           if(a==null || a==""){
                               layui.layer.msg("不能为空...",function () {});
                               return false;
                           }else if(a>10000){
                               layui.layer.msg("抱歉，金额不能大于1W...",function () {});
                               return false;
                           }else if(a<100){
                               layui.layer.msg("抱歉，金额不能小于100...",function () {});
                               return false;
                           }
                           var str=$("#moneyform").serialize();
                            $.post("/Vip/updatevipmoney",str,function () {
                                layer.msg("充值成功...")
                                layer.close(index);
                                table.reload("vipTable");
                            })
                        }
                    });
                    break;
                case "stat":
                    layer.open({
                        type: 1,
                        title: "会员卡状态 ",
                        skin: "layui-layer-molv",
                        anim: 0,
                        offset:"120px",
                        area: "500px",
                        content: $("#stat"),
                        btn: ['确定','返回'],
                        success: function () {
                            $("#huiyuankaid").empty();
                            $("#mingchen").val(data.name);
                            $("#card").val(data.vipType.id);
                            $("#peoples").val(data.admin.id);
                            console.log(data)
                        },
                        yes:function (index) {
                            var card=$('input[name="a"]:checked').val();
                            $("#zhuangtai").val(card);
                               if (card==2){
                                   if(data.jilu.id==2){
                                       layer.msg("该卡已挂失...",function () {})
                                       return false;
                                   }
                                   $.post("/Vip/guashi",{"id":data.id},function () {
                                      var str=$("#typeform").serialize();
                                      $.post("/Vip/jilu",str,function () {
                                          layer.msg("挂失成功...");
                                          layer.close(index);
                                          table.reload("vipTable");
                                      })
                                   })
                               }else if (card==3){
                                   if(data.jilu.id!=2){
                                       layer.msg("如需补卡请先挂失...",function () {})
                                       return false;
                                   }
                                   if(data.jilu.id==2){
                                       layer.open({
                                           type: 1,
                                           title: "补办卡",
                                           skin: "layui-layer-molv",
                                           anim: 0,
                                           offset:"120px",
                                           area: "500px",
                                           content: $("#phonesss"),
                                           btn: ['确定','返回'],
                                           success: function () {
                                               console.log(data)
                                               $("#yuliuaaa").val('');
                                               $("#idcardaaa").val('');
                                               $(":input[name = 'yuliuphone']").blur(function (str) {
                                                   var phone=$("#yuliuaaa").val();
                                                   $.post("/Vip/getphone",{"phone":phone},function () {
                                                       if(data.phone==phone){
                                                           $("#idcardaaa").val(data.vipType.name);
                                                       }else{
                                                           layer.msg("手机号不正确...",function () {});
                                                       }
                                                   })
                                               })

                                           },
                                           yes:function (index) {
                                               var phone=$("#yuliuaaa").val();
                                               if (phone==null || phone==""){
                                                   layer.msg("请填写预留手机号...");
                                                   return false;
                                               }
                                               var idcardaaa=$("#idcardaaa").val();
                                               if(idcardaaa==null || idcardaaa==""){
                                                   layer.msg("请仔细填写...");
                                                   return false;
                                               }
                                               $.post("/Vip/buka",{"id":data.id},function () {
                                                   var str=$("#typeform").serialize();
                                                   $.post("/Vip/jilu",str,function () {
                                                       layer.msg("补卡成功...");
                                                       layer.closeAll();
                                                       table.reload("vipTable");
                                                   })
                                               })
                                           }
                                       });
                                   }
                               } else if (card==4){
                                   if(data.jilu.id==2){
                                       layer.msg("抱歉，无法补办...",function () {})
                                       return false;
                                   }
                                   layer.open({
                                       type: 1,
                                       title: "换卡",
                                       skin: "layui-layer-molv",
                                       anim: 0,
                                       offset:"120px",
                                       area: "500px",
                                       content: $("#huanka"),
                                       btn: ['确定','返回'],
                                       success: function () {
                                           $("#danqianhuiuan").val(data.vipType.name);
                                           $("#jifenaa").val(data.integral);
                                           $("#idddddd").val(data.id);
                                           layui.form.render("select");
                                           //排除当前人的id
                                           $.get("/Vip/isnotid",{"id":data.vipType.id},function (data) {
                                               $.each(data,function () {
                                                   var opt=$("<option></option>").appendTo("#huiyuankaid");
                                                   opt.text(this.name).val(this.id);
                                               })
                                               layui.form.render("select");
                                           })
                                       },
                                       yes:function (index) {
                                          var huiyuankaid=$("#huiyuankaid").val();
                                          if (huiyuankaid==-1){
                                              layer.msg("请选择你要换的卡...",function () {})
                                              return false;
                                          }
                                          var str=$("#huankaform").serialize();
                                          $.post("/Vip/huanka",str,function () {
                                              var str=$("#typeform").serialize();
                                              $.post("/Vip/jilu",str,function () {
                                                      layer.msg("换卡成功...");
                                                      layer.closeAll();
                                                      table.reload("vipTable");
                                              })
                                          })
                                       }
                                   });
                               }else if (card==5){
                                   var str=$("#typeform").serialize();
                                   $.post("/Vip/jilu",str,function () {
                                       $.post("/Vip/delvip",{"id":data.id},function () {
                                           layer.msg("退卡成功...");
                                           layer.close(index);
                                           table.reload("vipTable");
                                       })
                                   })
                               }
                        }
                    });
                    break;
            }
        })
    })
    function SearchData() {
        layui.table.reload("vipTable",{
            page:{
                curr:1
            },
            where:{
                "name":$("#username").val(),
                "viptypeid":$("#roles").val()
            }
        })
    }
</script>

<%--性别判断0男1女--%>
<%--{{d.sex == 0 ? '男' : '女'}}--%>
<%--显示会员卡--%>
<script type="text/html" id="idcard">
    {{d.vipType.name}}
</script>
<%--显示状态--%>
<script type="text/html" id="Integer">
    {{d.jilu.name}}
</script>
<%--导航按钮--%>
<script type="text/html" id="toolbarDemo">
    <button class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon layui-icon-add-circle"></i> 添加</button>
    <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="batchDelete"><i class="layui-icon layui-icon-delete"></i> 批量删除</button>
</script>
<%--操作按钮--%>
<script type="text/html" id="barDemo">
    <a href="javascript:void (0)" lay-event="select" title="查看"><span class="layui-icon layui-icon-list"></span></a>&ensp;
    <a href="javascript:void (0)" lay-event="update" title="修改"><span class="layui-icon layui-icon-edit"></span></a>&ensp;
    <a href="javascript:void (0)" lay-event="money" title="充值"><span class="layui-icon layui-icon-rmb"></span></a>&ensp;
    <%--<a href="javascript:void (0)" lay-event="duihuan" title="兑换"><span class="layui-icon layui-icon-face-smile"></span></a>&ensp;--%>
    <a href="javascript:void (0)" lay-event="stat" title="状态"><span class="layui-icon layui-icon-more"></span></a>
</script>

<script>
    function random() {
        var s="123456789";
        var a=6;
        var y="";
        for (var i=0;i<a;i++){
            var b=Math.random()*9;
            var c=Math.floor(b);
            y=y+s[c];
        }
        $("#huiyuanid").val(y);
    }

</script>
<script>
    function fomrReset(){
         document.getElementById("addform").reset();
     }
</script>
<script>
    //  获取时间
    function getNow(s) {
        return s < 10 ? '0' + s : s;
    }
    function dates() {
        var now = new Date();
        //格式化日，如果小于9，前面补0
        var day = ("0" + now.getDate()).slice(-2);
        //格式化月，如果小于9，前面补0
        var month = ("0" + (now.getMonth() + 1)).slice(-2);
        //拼装完整日期格式
        var today = now.getFullYear() + "-" + (month) + "-" + (day);
        return today;
    }
    $("#shijian").val(dates());
    $("#lptimer").val(dates());
</script>
</html>
